package com.sbr.seb.rule.aspect;

import java.util.Arrays;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Aspect
public class LogBeforeAspect {

	private static final Logger logger = LoggerFactory.getLogger(LogBeforeAspect.class);
	
	
	@Before("execution(* *.*(..))")
	public void logBefore(JoinPoint jp) throws Throwable {
		try {
			logger.info("début de la méthode "+jp.getSignature().getName()+"() de "+jp.getTarget()+" invoquée avec "+Arrays.toString(jp.getArgs()));
		} catch (Exception e) {
			logger.error("ERROR",e);
		}
	}
}